using System;
using System.Collections.Generic;
using System.Text;

namespace MicroFractal.iTunesBrowser.Business
{
    /// <summary>
    /// Representa un genero musical.
    /// </summary>
    public class Genre : IDownloadableObject
    {

        #region Constructors

        public Genre(string name)
        {
            _name = name;
            _songs = new List<Song>();
        }

        #endregion

        #region Properties

        private string _name;
        /// <summary>
        /// Obtiene o establece el nombre del genero.
        /// </summary>
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }

        private List<Song> _songs;
        /// <summary>
        /// Obtiene la lista de temas que pertenecen a ese genero.
        /// </summary>
        public List<Song> Songs
        {
            get { return _songs; }
            set { _songs = value; }
        }
	
        #endregion

        #region Overrides

        public override bool Equals(object obj)
        {
            if (obj != null && obj is Genre)
            {
                return _name == ((Genre)obj)._name;
            }
            return false;
        }

        public override string ToString()
        {
            return _name;
        }

        public override int GetHashCode()
        {
            return _name.GetHashCode();
        }

        #endregion


        #region IDownloadableObject Members

        public IList<Song> GetDownloadableSongs()
        {
            return _songs;
        }

        #endregion
    }
}
